<?php

namespace App\Providers;

use App\Article;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        \Validator::extend('updateOnly',function($attribute,$value,$parameter){
           if($value!=$parameter[0]){
               if(Article::where($attribute,$value)->count()>0){
                   return false;
               }
           }
           return true;
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
